package com.sgl.retrofitdemo.net;

import com.sgl.retrofitdemo.net.api.UserApi;
import com.sgl.retrofitdemo.net.model.UserDataModel;

/**
 * Created by sunqiyong on 2016/11/13.
 */

public class DataSourceFactory {
    private UserApi mUserApi;

    private static class Holder {
        private static DataSourceFactory dataSourceFactory = new DataSourceFactory();
    }

    public static DataSourceFactory getInstance() {
        return Holder.dataSourceFactory;
    }

    public UserDataModel createUserDataModel(){
        if(mUserApi == null){
            mUserApi = ApiService.getInstance().createApi(UserApi.class);
        }
        return new UserDataModel(this.mUserApi);
    }
}
